import 'package:flutter_book/data/model/yck/xpath/xpath_selector.dart';

import '../rule.dart';
import 'single_rule.dart';

class XpathParser extends IParser<SingleRule> {
  XpathParser(SingleRule rule) : super(rule);

  @override
  Future<String> getString(String json, {Map<String, dynamic>? valueMap}) async {
    return XPath.source(json).query(rule.ruleContent).get();
  }

  @override
  Future<List<String>> getStringList(String json, {Map<String, dynamic>? valueMap}) async {
    return XPath.source(json).query(rule.ruleContent).list();
  }
}
